/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package z.h.w.jar.arithmetic.method;

/**
 *
 * @author EnzoZhong @date 2011.10.30
 */
public class SearchEnu implements SearchMethodApi {

     /**
      * 枚举寻找，逐个匹配
      *
      * @param <Type>
      * @param array
      * @param target
      * @return
      */
     @Override
     public <Type extends Comparable<? super Type>> Integer search(Type[] array, Type target) {
          Integer len = array.length;
          for (Integer x = 0; x < len; x++) {
               if (target.compareTo(array[x]) == 0) {
                    return x;
               }
          }
          return 0;
     }
}
